package com.shakespace.devassistant.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import com.shakespace.devassistant.extensions.viewBindings

abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {

    // 使用反射方式实现
    protected val binding: VB by lazy(mode = LazyThreadSafetyMode.NONE) {
        viewBindings(layoutInflater)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(binding.root)
        onViewBind()
    }

    abstract fun onViewBind()
}